package com.ruoyi.web.controller.system;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.base.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.page.TableDataInfo;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.base.BaseController;
import com.ruoyi.system.domain.WdyVcFundAssetDailyProfit;
import com.ruoyi.system.service.IWdyVcFundAssetDailyProfitService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * vc基金资产日收益 信息操作处理
 * 
 * @author ruoyi
 * @date 2020-04-04
 */
@Controller
@RequestMapping("/system/wdyVcFundAssetDailyProfit")
public class WdyVcFundAssetDailyProfitController extends BaseController
{
    private String prefix = "system/wdyVcFundAssetDailyProfit";
	
	@Autowired
	private IWdyVcFundAssetDailyProfitService wdyVcFundAssetDailyProfitService;
	
	@RequiresPermissions("system:wdyVcFundAssetDailyProfit:view")
	@GetMapping()
	public String wdyVcFundAssetDailyProfit()
	{
	    return prefix + "/wdyVcFundAssetDailyProfit";
	}
	
	/**
	 * 查询vc基金资产日收益列表
	 */
	@RequiresPermissions("system:wdyVcFundAssetDailyProfit:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(WdyVcFundAssetDailyProfit wdyVcFundAssetDailyProfit)
	{
		startPage();
        List<WdyVcFundAssetDailyProfit> list = wdyVcFundAssetDailyProfitService.selectWdyVcFundAssetDailyProfitList(wdyVcFundAssetDailyProfit);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出vc基金资产日收益列表
	 */
	@RequiresPermissions("system:wdyVcFundAssetDailyProfit:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(WdyVcFundAssetDailyProfit wdyVcFundAssetDailyProfit)
    {
    	List<WdyVcFundAssetDailyProfit> list = wdyVcFundAssetDailyProfitService.selectWdyVcFundAssetDailyProfitList(wdyVcFundAssetDailyProfit);
        ExcelUtil<WdyVcFundAssetDailyProfit> util = new ExcelUtil<WdyVcFundAssetDailyProfit>(WdyVcFundAssetDailyProfit.class);
        return util.exportExcel(list, "wdyVcFundAssetDailyProfit");
    }
	
	/**
	 * 新增vc基金资产日收益
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存vc基金资产日收益
	 */
	@RequiresPermissions("system:wdyVcFundAssetDailyProfit:add")
	@Log(title = "vc基金资产日收益", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(WdyVcFundAssetDailyProfit wdyVcFundAssetDailyProfit)
	{		
		return toAjax(wdyVcFundAssetDailyProfitService.insertWdyVcFundAssetDailyProfit(wdyVcFundAssetDailyProfit));
	}

	/**
	 * 修改vc基金资产日收益
	 */
	@GetMapping("/edit/{id}")
	public String edit(@PathVariable("id") Long id, ModelMap mmap)
	{
		WdyVcFundAssetDailyProfit wdyVcFundAssetDailyProfit = wdyVcFundAssetDailyProfitService.selectWdyVcFundAssetDailyProfitById(id);
		mmap.put("wdyVcFundAssetDailyProfit", wdyVcFundAssetDailyProfit);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存vc基金资产日收益
	 */
	@RequiresPermissions("system:wdyVcFundAssetDailyProfit:edit")
	@Log(title = "vc基金资产日收益", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(WdyVcFundAssetDailyProfit wdyVcFundAssetDailyProfit)
	{		
		return toAjax(wdyVcFundAssetDailyProfitService.updateWdyVcFundAssetDailyProfit(wdyVcFundAssetDailyProfit));
	}
	
	/**
	 * 删除vc基金资产日收益
	 */
	@RequiresPermissions("system:wdyVcFundAssetDailyProfit:remove")
	@Log(title = "vc基金资产日收益", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(wdyVcFundAssetDailyProfitService.deleteWdyVcFundAssetDailyProfitByIds(ids));
	}
	
}
